UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kvWqdl+OnbqjKLUSVQPcCVCDOdh7lsKjwljps9HLAGw=' 
WHERE 
  key_id = 'cab26358d8259fccb2b354dec876ca5daaffed5ee4c07783920bc79204d85df8' 
  AND (
    token = 'kvWqdl+OnbqjKLUSVQPcCVCDOdh7lsKjwljps9HLAGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040