UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gQsiE1/NNvyklIhZx3hz7lssWS4NVtrA83W3noIPuBM=' 
WHERE 
  key_id = '5a05bb12a1cbc8b9a00494ccf43d3eb419cd033b4f893cf7d24f1f3e5fded7c3' 
  AND (
    token = 'gQsiE1/NNvyklIhZx3hz7lssWS4NVtrA83W3noIPuBM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029