UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jV5zMX+5GzRvHToX8QrqWGr3KwFNLx2mEcg5uHprLJI=' 
WHERE 
  key_id = 'a313302e9cb1ce0266525ac8f9f31e253040b419c04ef90e7fbb8703888efbfe' 
  AND (
    token = 'jV5zMX+5GzRvHToX8QrqWGr3KwFNLx2mEcg5uHprLJI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032