UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hXJxsChbqqb/S/mkV6VqyrhrG9A0e2im4o4V1aflWDw=' 
WHERE 
  key_id = '58b458db9879d30cbd95c3b4557d480ebab966915c1de478093bc667156d3e07' 
  AND (
    token = 'hXJxsChbqqb/S/mkV6VqyrhrG9A0e2im4o4V1aflWDw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024