UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YMsn84opdaohbchbz08NvkD3ia3hZ0e5cYTrSrkSjZE=' 
WHERE 
  key_id = '56ec3f4cfe50e4b7995dbada10e2e14859652a82b3b62a36f82e1e01deae02d4' 
  AND (
    token = 'YMsn84opdaohbchbz08NvkD3ia3hZ0e5cYTrSrkSjZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035