UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3vK6t6D2qTANGB9/y2exqtvTqKPc4pvTGQiucwIU8+4=' 
WHERE 
  key_id = 'd0ce5251ef0b862d937936498712fb728c1e4f9377a7396c404a3de6d3d98854' 
  AND (
    token = '3vK6t6D2qTANGB9/y2exqtvTqKPc4pvTGQiucwIU8+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035