UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a6qXLTfFvapUKYRCI1JusGZb48k/mjbDo9v4+tDIm54=' 
WHERE 
  key_id = '7eb1f616c8b08754ac2e11dd97da21ccb9542ca52da168123677673ac95e0352' 
  AND (
    token = 'a6qXLTfFvapUKYRCI1JusGZb48k/mjbDo9v4+tDIm54=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044