UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wpZUeoJfoEd4BtwjQBM2p6h79FeLzIHTLO5s+PPi92Q=' 
WHERE 
  key_id = 'bf2c3fb22a8dc538218c4b90f6ad569034f9e2ed5610d61034bade31ea33fd19' 
  AND (
    token = 'wpZUeoJfoEd4BtwjQBM2p6h79FeLzIHTLO5s+PPi92Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044