UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a0zVqAbBZFDo1BPKWJssVn381pSzFVwd45j6fsJRtoQ=' 
WHERE 
  key_id = '4af185656d4e4a273a0eb568c589bfa265337b688328c5ace3dc121b7f119753' 
  AND (
    token = 'a0zVqAbBZFDo1BPKWJssVn381pSzFVwd45j6fsJRtoQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048