UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PWcjbHGsfqUb5i9RFasrAzdJD5f+rDF6e2LzD6Uf2fQ=' 
WHERE 
  key_id = 'd0dc37e7ce8ecc898140e2eb2ec76bd251831a8f30980733e62f1852681d02ad' 
  AND (
    token = 'PWcjbHGsfqUb5i9RFasrAzdJD5f+rDF6e2LzD6Uf2fQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037