UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dq59/XLX2Md5QvTA6kxVORH9IvPXgaCekaWDCOrjysM=' 
WHERE 
  key_id = '4e8820ebd83cccc57661dc0f9854c9ca1e3ef171894935617ff1c536f76a0d6d' 
  AND (
    token = 'dq59/XLX2Md5QvTA6kxVORH9IvPXgaCekaWDCOrjysM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056