UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VJh64A3dsctXaHfdEwlXzy5XzWJErJVo+qpdrCnuuCM=' 
WHERE 
  key_id = '2aacb84b4761b86d86ad7957344aa29f966f777439ad1298f6b150822e01fd97' 
  AND (
    token = 'VJh64A3dsctXaHfdEwlXzy5XzWJErJVo+qpdrCnuuCM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034