UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6/P/MML3ZxGtsVaOEnkenA08he+xbkZg+vadY/7hzEs=' 
WHERE 
  key_id = '575e0d8a1297d9ba85452b39ac8e9311d57575e36f91f6086b3efb03f338c077' 
  AND (
    token = '6/P/MML3ZxGtsVaOEnkenA08he+xbkZg+vadY/7hzEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024