UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'erQKJoD+wZ2rkmDJ0d0JuFm4FhZtWulIHsuv+G5s5g4=' 
WHERE 
  key_id = '7a338b4188cd06bed40f123dbf2755dc4d186ead513004507586ca72790d8e97' 
  AND (
    token = 'erQKJoD+wZ2rkmDJ0d0JuFm4FhZtWulIHsuv+G5s5g4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047