UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4jz153NcoWFbq8eCLLGizPhGtl9aMPS7DdX+QM+rZYI=' 
WHERE 
  key_id = '907c42df01ca1ae95063836dd9948d19da664da1cf666fd249c46fdadbebcbde' 
  AND (
    token = '4jz153NcoWFbq8eCLLGizPhGtl9aMPS7DdX+QM+rZYI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024